package com.bite.api;

import com.bite.model.ProductInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(value = "product-service",path = "/product")
public interface ProductInteface {
        @RequestMapping("/{productId}")
        public ProductInfo selectProductById(@PathVariable("productId") Integer productId);


        //传递单个参数
        @RequestMapping("p1")
        public String p1(@RequestParam("id") Integer id);


        //传递多个参数 多加几个RequetParam注解进行参数绑定即可
        @RequestMapping("p2")
        public String p2(@RequestParam("id") Integer id, @RequestParam("name") String name);

        //传递对象 需要使用到SpringQueryMap注解来实现
        @RequestMapping("p3")
        public String p3(@SpringQueryMap ProductInfo productInfo);

        //传递json对象
        @RequestMapping("p4")
        public String p4(@RequestBody ProductInfo productInfo);
}
